#include<iostream>
#include<string>
using namespace std;
string fun(string s1, string s2)
{
	string ans;
	string s;
	int m = s2.size();
	int n = 0;
	for (int i = 0; i <= 32; i++) {
		int temp = 1;
		int j = i;
		while (j--) {
			temp *= 2;
		}
		if (temp == m) {
			n = i;
			break;
		}
	}
	s = s1;
	int x = 32;
	if (32 % n != 0) {
		int k = n - (32 % n);
		x += k;
		while (k--) {
			s = "0" + s;
		}
	}
	int res = 0;
	for (int i = 0; i < x; i++) {
		if (i % n == 0 && (i != 0)) {
			ans += s2[res];
		}
		else {
			res = res * 2 + (s[i] == '1' ? 1 : 0);
		}
	}
	ans += s2[res];
	return ans;
}
int main()
{
	cout << fun("01111000", "10") << endl;
	return 0;
}